<template>
    <div class="footer">
        <div @click="submit" class="button">参与竞拍</div>
    </div>
</template>

<script>
import { Dialog } from 'vant'
    export default {
        props:['pid'],
        methods:{
            submit(){
                const userState=sessionStorage.getItem('token')
                // 判断当前是否登录，如果未登录
                if(!userState){
                    // 确认框
                    Dialog.alert({
                        message:'当前未登录，请先登录',
                        confirmButtonText:'前去登录',
                        confirmButtonColor:'#9a4145'
                    }).then(() => {
                        // 点击确认后回到登录
                        this.$router.push('/login')
                    })
                }else{
                    // 登录状态 已登录跳转到确认订单页
                    this.$router.push(`/order/${this.pid}`)
                }
            }
        }
    }
</script>

<style lang="scss" scoped>
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    justify-content: center;
    background-color: #fff;
    .fenxiang {
        display: flex;
        align-items: center;
        margin: 0.625em 0;
        >div {
            font-size: .9em;
            padding: 0 0.315em;
        }
    }
    .button {
        margin: 0.625em auto;
        background-color: #444d5c;
        color: #fff;
        width: 21.38em;
        text-align: center;
        padding: 0.625em 0;
        border-radius: 0.31em;
    }
}
</style>